import cv2

def pyramid(image, scale=1.2, min_size=(128, 128)):
    """
    生成金字塔缩放序列
    :param image: 输入图像
    :param scale: 每次缩放的比例
    :param min_size: 最小尺寸
    :yield: 逐层缩放的图像
    """
    yield image
    while True:
        w = int(image.shape[1] / scale)
        h = int(image.shape[0] / scale)
        if w < min_size[0] or h < min_size[1]:
            break
        image = cv2.resize(image, (w, h))
        yield image



